<h1>Add a new collection: <strong *ngIf="collectionTemplate">{{collectionTemplate?.label}}</strong></h1>
<hr/>
<ng-template [ngIf]="!collectionTemplate" [ngIfElse]="addCollectionForm">
  <form [formGroup]="collectionTemplateForm" (ngSubmit)="onTemplateUse()">
    <div class="form-group row">
      <label for="collectionTemplateSelector" class="col-sm-2 col-form-label">Template: </label>
      <div class="col-sm-9">
        <select formControlName="collectionTemplateInstance" id="collectionTemplateSelector" class="custom-select">
          <option [ngValue]="undefined"></option>
          <option *ngFor="let _collectionTemplate of collectionTemplateList" [ngValue]="_collectionTemplate">
            #{{_collectionTemplate.public_id}}: {{_collectionTemplate.label}}
          </option>
        </select>
      </div>
      <div class="col-sm-1">
        <button type="submit" class="btn btn-block btn-primary">Use</button>
      </div>
    </div>
  </form>
</ng-template>
<ng-template #addCollectionForm>
  {{collectionTemplate | json}}
</ng-template>
